
import React from 'react'
import dynamic from 'dva/dynamic';
import pathToRegexp from 'path-to-regexp';
const modelNotExisted = (app, model) =>
	!app._models.some(({ namespace }) => {
		return namespace === model.namespace.substring(model.namespace.lastIndexOf('/') + 1);
	});

export const dynamicWrapper = (app, models, component) => {
	models.forEach(model => {
		if (modelNotExisted(app, model)) {
			app.model(model);
		}
	});
	return props => {
		let Component = component
		return (<Component {...props} />)

	};
};
